using NbMeterServices;
using static NewLife.Remoting.ApiHttpClient;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSqlSugarServices();

builder.Services.AddSingleton<NbService>(sp=>
{
    var configuration = sp.GetService<IConfiguration>();
    // 使用解析出的IConfiguration创建MyService的实例  
    return new NbService(configuration);
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseAuthorization();
app.MapControllers();
app.Services.GetService<NbService>();



app.Run();
